const basestr = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()-_=+"

class HighNumber {
  static MAX_BASE = basestr.length; // 最大进制

  static toString(num, base) {
    let result = "";
    while (num > 0) {
      let remainder = num % base;
      result = basestr[remainder] + result;
      num = Math.floor(num / base);
    }
    return result;
  }

  static toNumber(num, base) {
    let result = 0;
    let power = 0;
    for (let i = num.length - 1; i >= 0; i--) {
      let digit = basestr.indexOf(num[i]);
      result += digit * Math.pow(base, power);
      power++;
    }
    return result;
  }

}

console.log(HighNumber.toString(2435813248951233000, HighNumber.MAX_BASE))

module.exports = HighNumber